Skip to content

change database load to partition ingest into multiple objects - #7437

Merged
mccanne merged 3 commits into
mainfrom
framecap
Oct 9, 2026
Merged

mccanne merged 3 commits into
mainfrom
framecap

Conversation

@mccanne

@mccanne mccanne commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

This commit restores the old behavior of database ingest where input is broken up into objects based on configured caps. The old method used bytes threshold but this isn't so easy to implement so we went with number-of-values caps. Bytes limits can be revisited later.

We introduced three new flags: -objectcap, -framecap, and -inputcap to control the size of storage objects, the size of BSUP frames, and the size of vector batches on the input. The limits don't break vectors into pieces so the sizes get rounded up to the first vector that exceeds the cap. We didn't want to muck around with breaking vectors up into smaller pieces on these boundaries but we can revisit this later.

@nwt nwt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only non-nit is the comment on db/pools/config.go.

Comment thread sio/jsonio/reader.go Outdated
)

var VecBatchSize uint32 = 10 * 1024
var DefaultInputCap uint32 = 10 * 1024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: No reason for this to be a variable.

Suggested change
var DefaultInputCap uint32 = 10 * 1024
const defaultInputCap uint32 = 10 * 1024

Comment thread bsup/ztests/framecap.yaml
@@ -0,0 +1,9 @@
script: |
seq 100 | super -inputcap 5 -framecap 5 -o out.bsup -

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Put a prefix on this flag since it only affects BSUP.

Suggested change
seq 100 | super -inputcap 5 -framecap 5 -o out.bsup -
seq 100 | super -inputcap 5 -bsup.framecap 5 -o out.bsup -

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss. I'm gonna leave this for now and we can visit flags names overall.

Comment thread cli/outputflags/flags.go Outdated
"tab size to pretty print JSON and Super JSON output (0 for newline-delimited output")
fs.StringVar(&f.outputFile, "o", "", "write data to output file")
fs.BoolVar(&f.BSUP.Rows, "rows", false, "output BSUP in row format instead of columns")
fs.Uint64Var(&f.BSUP.FrameCap, "framecap", 10000, "number of values per BSUP frame")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Put this after "color" so these remain mostly ordered by flag name. Even better, call it "bsup.framecap" since it applies only to BSUP and then put it before "color".

Comment thread api/api.go
Comment on lines +41 to +42
ObjectCap uint64 `json:"objectcap"`
FrameCap uint64 `json:"framecap"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I don't feel strongly about this but knobs like these are usually suffixed with "lim", "limit", or "max" so one of those instead of "cap" might make their behavior a little clearer to system users and code readers. (My initial reaction was, "'Cap' probably means maximum here but if that were the case it'd just be 'max" so maybe it means something else.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second nit:

Suggested change
ObjectCap uint64 `json:"objectcap"`
FrameCap uint64 `json:"framecap"`
ObjectCap uint64 `json:"object_cap"`
FrameCap uint64 `json:"frame_cap"`

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna leave these as is since we will discuss and replace them all in a subsequent PR. No since replacing all the tests now and changing again.

Comment thread bsup/writer.go
Comment on lines 39 to +43
func NewColumnWriter(w io.WriteCloser) *ColumnWriter {
return NewColumnWriterWithCap(w, DefaultFrameCap)
}

func NewColumnWriterWithCap(w io.WriteCloser, frameCap uint64) *ColumnWriter {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think it's tidier to have just one constructor for which the zero value for a parameter gets you a reasonable default.

Comment thread cli/inputflags/flags.go
fs.BoolVar(&f.Dynamic, "dynamic", false, "disable static type checking of inputs")
fs.StringVar(&opts.Format, "i", "auto", "format of input data [auto,arrows,bsup,csv,json,line,parquet,sup,tsv,zeek]")
fs.BoolVar(&f.Static, "static", false, "force static type checking of inputs")
fs.IntVar(&opts.InputCap, "inputcap", 0, "limit size of batched units of input")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Put this after "i" so these remain ordered by flag name.

Comment thread db/data/object.go
Comment on lines 17 to 19
const (
DefaultThreshold = 500 * 1024 * 1024
DefaultObjectCap = 1 * 1024 * 1024
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

const DefaultObjectCap = 024 * 1024

Comment thread db/pools/config.go Outdated
if objectCap == 0 {
objectCap = data.DefaultObjectCap
}
if objectCap == 0 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if objectCap == 0 {
if frameCap == 0 {

This commit restores the old behavior of database ingest where input
is broken up into objects based on configured caps.  The old method
used bytes threshold but this isn't so easy to implement so we went
with number-of-values caps.  Bytes limits can be revisited later.

We introduced three new flags: -objectcap, -framecap, and -inputcap
to control the size of storage objects, the size of BSUP frames,
and the size of vector batches on the input.  The limits don't break
vectors into pieces so the sizes get rounded up to the first vector
that exceeds the cap.  We didn't want to muck around with breaking
vectors up into smaller pieces on these boundaries but we can revisit
this later.
@mccanne
mccanne merged commit 40c53fd into main Oct 9, 2026
2 checks passed
@mccanne
mccanne deleted the framecap branch October 9, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants